<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<script>
var s1 = "acc"
var s2 = "aac";
var res = s2.localeCompare(s1);
console.log(res);
var a = ["a8888b", "aa", "abc", "aaaa", "bbbb", "abcddd"];
a.sort(function (a, b){
//    return -a.localeCompare(b);
    return b.length - a.length;
});

console.log(a);
</script>
</body>
</html>